package com.ctshk.rpc.hotel.service.impl;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.hutool.json.XML;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.IsDeletedCode;
import com.ctshk.common.enums.ProductType;
import com.ctshk.common.enums.SystemError;
import com.ctshk.common.enums.TicketSourceType;
import com.ctshk.common.model.TokenUser;
import com.ctshk.rpc.hotel.dto.*;
import com.ctshk.rpc.hotel.dto.westminsterRoom.*;
import com.ctshk.rpc.hotel.entity.*;
import com.ctshk.rpc.hotel.mapper.*;
import com.ctshk.rpc.hotel.req.WestminsterRoomTypeReq;
import com.ctshk.rpc.hotel.service.IWestMinisterHotelService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import static com.ctshk.rpc.hotel.APIUtils.APIUtil.callAPIFunc;

@Slf4j
@DubboService
public class WestMinisterHotelServiceImpl implements IWestMinisterHotelService {
    @Autowired
    private HotelMapper hotelMapper;
    @Autowired
    private HotelProductMapper hotelProductMapper;
    @Autowired
    private HotelRoomTypeMapper hotelRoomTypeMapper;
    @Autowired
    private HotelProductCostMapper hotelProductCostMapper;
    @Autowired
    private HotelProductCostDateMapper hotelProductCostDateMapper;
    //删除标识 0：未删除，1：已删除
    private static final Integer NO_DELETE  = 0;
    private static final Integer YES_DELETE  = 1;

    @Override
    @Transactional(readOnly=false,propagation= Propagation.REQUIRED)
    public Result saveWestminsterHotel(TokenUser user, List<String> hotelCode) {
        if(CollectionUtils.isNotEmpty(hotelCode)){
            for (int m = 0; m < hotelCode.size(); m++) {
                log.info("hotelCode[{}]", hotelCode.get(m));
                String param =
                        "<OTA_HotelDescriptiveInfoRQ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                                "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Version=\"0\"\n" +
                                "xmlns=\"http://www.opentravel.org/OTA/2003/05\" primaryLangID=\"en-us\">\n" +
                                "<POS>\n" +
                                " <Source>\n" +
                                "\t<RequestorID ID=\"api@ctshk.com\" MessagePassword=\"111111\"/>\n" +
                                " </Source>\n" +
                                "</POS>\n" +
                                "<HotelDescriptiveInfos>\n" +
                                "<HotelDescriptiveInfo HotelCode=\""+hotelCode.get(m)+"\"/>\n" +
                                "</HotelDescriptiveInfos>\n" +
                                "</OTA_HotelDescriptiveInfoRQ>";
                String result = callAPIFunc("text/xml;charset=utf-8", "http://ws.adholidays.com/hotelapidev/otaservice.aspx", param, "POST");
                System.out.println(result);
                if (result.contains("HotelInfo")) {
                    // xml解析JSON
                    //获取{"Position":{"Latitude":22.2768,"Longitude":114.1653},"HotelName":"Conrad Hong Kong Hotel455677"}
                    JSONObject hotelInfoObj = XML.toJSONObject(result).getJSONObject("OTA_HotelDescriptiveInfoRS").getJSONObject("HotelDescriptiveContents").getJSONObject("HotelDescriptiveContent").getJSONObject("HotelInfo");
                    HotelInfo hotelInfo = JSONUtil.toBean(hotelInfoObj, HotelInfo.class);
                    JSONObject TPA_Extensions = XML.toJSONObject(result).getJSONObject("OTA_HotelDescriptiveInfoRS").getJSONObject("HotelDescriptiveContents").getJSONObject("HotelDescriptiveContent").getJSONObject("TPA_Extensions");
                    TPAExtensions TPA_ExtensionsObj = (TPAExtensions) JSON.parseObject(String.valueOf(TPA_Extensions), TPAExtensions.class);
                    TPAExtensions tpaExtensions = JSONUtil.toBean(TPA_Extensions, TPAExtensions.class);
                    JSONObject MultimediaDescriptionsObj = XML.toJSONObject(result).getJSONObject("OTA_HotelDescriptiveInfoRS").getJSONObject("HotelDescriptiveContents").getJSONObject("HotelDescriptiveContent").getJSONObject("MultimediaDescriptions");
                    MultimediaDescriptions MultimediaDescriptions = JSONUtil.toBean(MultimediaDescriptionsObj, MultimediaDescriptions.class);

                    JSONObject jsonArray = XML.toJSONObject(result).getJSONObject("OTA_HotelDescriptiveInfoRS").getJSONObject("HotelDescriptiveContents").getJSONObject("HotelDescriptiveContent").getJSONObject("ContactInfos").getJSONObject("ContactInfo");
                    HotelContactInfo hotelContactInfo = JSONUtil.toBean(jsonArray, HotelContactInfo.class);

                    JSONObject AffiliationInfoObj = XML.toJSONObject(result).getJSONObject("OTA_HotelDescriptiveInfoRS").getJSONObject("HotelDescriptiveContents").getJSONObject("HotelDescriptiveContent").getJSONObject("AffiliationInfo");
                    AffiliationInfo AffiliationInfoObjs = (AffiliationInfo) JSON.parseObject(String.valueOf(AffiliationInfoObj), AffiliationInfo.class);
                    //将JSON数据设置到酒店对象
                    Hotel hotel = new Hotel();
                    if (TPA_ExtensionsObj.getHotelNameZhTw() != null && !TPA_ExtensionsObj.getHotelNameZhTw().equals("")) {
                        hotel.setName(TPA_ExtensionsObj.getHotelNameZhTw());
                    }
                    hotel.setGmtCreate(LocalDateTime.now());
                    hotel.setCreateId(user.getId());
                    if (TPA_ExtensionsObj.getLocationDescriptionZhTw() != null && !TPA_ExtensionsObj.getLocationDescriptionZhTw().equals("")) {
                        hotel.setAreaName(TPA_ExtensionsObj.getDisctrict());
                    }

                    if (CollectionUtils.isNotEmpty(hotelContactInfo.getPhones().getPhone())) {
                        hotel.setTelephone(hotelContactInfo.getPhones().getPhone().get(0).getPhoneNumber());
                    }
                    //hotel.setSourceType(SOURCE_TYPE_API);
                    if (CollectionUtils.isNotEmpty(hotelContactInfo.getPhones().getPhone())) {
                        hotel.setCityName(hotelContactInfo.getPhones().getPhone().get(0).getPhoneNumber());
                    }
                    hotel.setCityId(null);
                    hotel.setSourceType(ProductType.API_PRODUCT.getCode());
                    hotel.setProvinceName("");
                    hotel.setProvinceId(null);
                    hotel.setCityName(hotelContactInfo.getAddresses().getAddress().getCityName());
                    if (hotelContactInfo.getAddresses().getAddress().getCountryName() != null) {
                        hotel.setCountryName(hotelContactInfo.getAddresses().getAddress().getCountryName());
                    }
                    hotel.setLocation(hotelContactInfo.getAddresses().getAddress().getAddressLine());
                    hotel.setCountryId(null);
                    //
                    if (tpaExtensions.getHotelNameZhTw() != null) {
                        hotel.setBrandName(tpaExtensions.getHotelNameZhTw());
                    }
                    if (hotelContactInfo.getAddresses().getAddress().getPostalCode() != null) {
                        hotel.setPostalCode(hotelContactInfo.getAddresses().getAddress().getPostalCode());
                    }
                    hotel.setId(IdWorker.getId());
                    hotel.setIsDeleted(NO_DELETE);
                    hotel.setAreaId(null);
                    hotel.setBrandId(null);
                    hotel.setBusinessDistrictId(null);
                    hotel.setEnName(hotelInfo.getHotelName());
                    hotel.setCoverMap("");
                    hotel.setCustomerGuide("");
                    //if(ContactInfosObj.getJSONObject("Emails").getJSONObject("Email")!=null){
                    //  hotel.setEmail(ContactInfosObj.getJSONObject("Emails").getJSONObject("Email").toString());
                    //}
                    //if(ContactInfosObj.getJSONObject("HotelName")!=null){
                    //  hotel.setEnName(ContactInfosObj.getJSONObject("HotelName").toString());
                    //}
                    hotel.setFinalRenovationTime(null);
                    hotel.setFloorNum(null);
                    if (CollectionUtils.isNotEmpty(MultimediaDescriptions.getMultimediaDescription())) {
                        if (MultimediaDescriptions.getMultimediaDescription().get(0).getTextItems() != null) {
                            if (MultimediaDescriptions.getMultimediaDescription().get(0).getTextItems().getTextItem() != null) {
                                if (MultimediaDescriptions.getMultimediaDescription().get(0).getTextItems().getTextItem().getDescription() != null) {
                                    hotel.setHotelContent(MultimediaDescriptions.getMultimediaDescription().get(0).getTextItems().getTextItem().getDescription());
                                }
                            }
                        }
                    }
                    hotel.setHotelPolicy(null);
                    hotel.setHotelSettings(null);
                    hotel.setHotelThemeJson(null);
                    hotel.setHotelTypeId(null);
                    hotel.setHotelTypeName(null);
//        if(ContactInfosObj.getJSONObject("Addresses").getJSONObject("Address").getJSONObject("CountryName")!=null&&!ContactInfosObj.getJSONObject("Addresses").getJSONObject("Address").getJSONObject("CountryName").equals("")){
//            hotel.setLocation(ContactInfosObj.getJSONObject("Addresses").getJSONObject("Address").getJSONObject("CountryName").toString());
//        }
                    hotel.setLocToDistrictDistance(null);
                    if (hotelInfo.getPosition().getLatitude() != null) {
                        hotel.setLatitude(hotelInfo.getPosition().getLatitude().toString());
                    }
                    if (hotelInfo.getPosition().getLongitude() != null) {
                        hotel.setLongitude(hotelInfo.getPosition().getLongitude().toString());
                    }
                    if (tpaExtensions.getLocationDescriptionZhTw() != null) {
                        hotel.setHotelContent(tpaExtensions.getLocationDescriptionZhTw());
                    }
                    if (tpaExtensions.getHotelDescriptionZhTw() != null) {
                        hotel.setOpeningTime(tpaExtensions.getHotelDescriptionZhTw());
                    }
                    //设置酒店图片
                    if (CollectionUtils.isNotEmpty(MultimediaDescriptions.getMultimediaDescription())) {
                        String pictureJson = "";
                        for (int i = 0; i < MultimediaDescriptions.getMultimediaDescription().size(); i++) {
                            MultimediaDescription multimediaDescription = MultimediaDescriptions.getMultimediaDescription().get(i);
                            if (multimediaDescription.getImageItems() != null) {
                                if (CollectionUtils.isNotEmpty(multimediaDescription.getImageItems().getImageItem())) {
                                    for (int j = 0; j < multimediaDescription.getImageItems().getImageItem().size(); j++) {
                                        ImageItem imageItem = multimediaDescription.getImageItems().getImageItem().get(j);
                                        if (imageItem.getImageFormat() != null) {
                                            if (imageItem.getImageFormat().getURL() != null && imageItem.getImageFormat().getTitle() != null) {
                                                pictureJson = pictureJson + "," + "{" + imageItem.getImageFormat().getTitle() + ":" + imageItem.getImageFormat().getURL() + "}";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (pictureJson != null && !pictureJson.equals("")) {
                            pictureJson = pictureJson.substring(1);
                            hotel.setShowPhotoJson(pictureJson);
                        } else {
                            hotel.setShowPhotoJson(null);
                        }
                    }
                    hotel.setStarLevel(null);
                    hotel.setStarLevelId(null);
                    if (tpaExtensions.getLocationDescriptionZhTw() != null) {
                        hotel.setLocation(tpaExtensions.getLocationDescriptionZhTw());//详细地址
                    }
                    if(TPA_ExtensionsObj.getDisctrict()!=null){
                        hotel.setBusinessDistrictName(TPA_ExtensionsObj.getDisctrict());//酒店位置名称
                    }
                    if(TPA_ExtensionsObj.getHotelDescriptionZhTw()!=null){
                        hotel.setOpeningTime(TPA_ExtensionsObj.getHotelDescriptionZhTw());//酒店开业时间
                    }
                    hotelMapper.insert(hotel);
                }
            }
        }else {
            return Result.failed(SystemError.HOTEL_10041);
        }
        return Result.success();
    }

    /**
     * 获取西敏酒店房型数据
     *
     * */
    @Override
    @Transactional(readOnly=false,propagation= Propagation.REQUIRED)
    public Result saveWestminsterRoom(TokenUser user) {
        //获取到静态文件中所有的Westminster酒店的cityCode和hotelCode,
        //日期起始日期取当前日期以及当前日期加一天，否则查不到数据
        //假设有一张酒店静态信息表，存储了hotelCode,hotelCityCode   调用解析zip包方法获得数据，并将解析的结果存放到List<WestminsterStaticInfoDTO>
        WestminsterRoomTypeReq westminsterRoomTypeReq = new WestminsterRoomTypeReq();
        List<WestminsterStaticInfoDTO> wsidList = new ArrayList<WestminsterStaticInfoDTO>();
        //以下测试使用
        WestminsterStaticInfoDTO westminsterStaticInfoDTOObj = new WestminsterStaticInfoDTO();
        westminsterStaticInfoDTOObj.setHotelCityCode("HKG");
        westminsterStaticInfoDTOObj.setHotelCode("00005");
        wsidList.add(westminsterStaticInfoDTOObj);
        if(CollectionUtils.isNotEmpty(wsidList)){
            for (int i = 0; i <wsidList.size(); i++) {
                WestminsterStaticInfoDTO westminsterStaticInfoDTO = wsidList.get(i);
                westminsterRoomTypeReq.setHotelCode(westminsterStaticInfoDTO.getHotelCode());
                westminsterRoomTypeReq.setHotelCityCode(westminsterStaticInfoDTO.getHotelCityCode());
                westminsterRoomTypeReq.setStart(LocalDate.now().plusDays(1));
                westminsterRoomTypeReq.setEnd(LocalDate.now().plusDays(2));//日期加一天
                westminsterRoomTypeReq.setCount("2");
                String param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                    "<OTA_HotelAvailRQ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                    "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Version=\"0\"\n" +
                    "xmlns=\"http://www.opentravel.org/OTA/2003/05\">\n" +
                    "<POS>\n" +
                    " <Source ISOCountry=\"\">\n" +
                    " <RequestorID ID=\"api@ctshk.com\" MessagePassword=\"111111\"/>\n" +
                    " </Source>\n" +
                    " </POS>\n" +
                    " <AvailRequestSegments>\n" +
                    " <AvailRequestSegment>\n" +
                    " <HotelSearchCriteria>\n" +
                    " <Criterion>\n" +
                    " <HotelRef HotelCityCode=\""+westminsterRoomTypeReq.getHotelCityCode()+"\" HotelCode=\""+westminsterRoomTypeReq.getHotelCode()+"\" HotelName=\"\" />\n" +
                    " <StayDateRange Start=\""+westminsterRoomTypeReq.getStart()+"\" End=\""+westminsterRoomTypeReq.getEnd()+"\" />\n" +
                    " <RatePlanCandidates>\n" +
                    " <RatePlanCandidate RatePlanID=\"\" />\n" +
                    " </RatePlanCandidates>\n" +
                    " <RoomStayCandidates>\n" +
                    " <RoomStayCandidate>\n" +
                    " <GuestCounts>\n" +
                    " <GuestCount AgeQualifyingCode=\"10\" Count=\""+westminsterRoomTypeReq.getCount()+"\" />\n";
            String paramEnd="";
            if(westminsterRoomTypeReq.getHasChild()!=null&&westminsterRoomTypeReq.getHasChild().equals("1")){
                paramEnd = " <GuestCount AgeQualifyingCode=\"8\" Count=\""+westminsterRoomTypeReq.getChildAgeNumber()+"\" Age=\""+westminsterRoomTypeReq.getChildAge()+"\" />\n" +
                        " </GuestCounts>\n" +
                        " </RoomStayCandidate>\n" +
                        " </RoomStayCandidates>\n" +
                        " </Criterion>\n" +
                        " </HotelSearchCriteria>\n" +
                        " </AvailRequestSegment>\n" +
                        "</AvailRequestSegments>\n" +
                        "</OTA_HotelAvailRQ>";
            }else {
                paramEnd =  " </GuestCounts>\n" +
                        " </RoomStayCandidate>\n" +
                        " </RoomStayCandidates>\n" +
                        " </Criterion>\n" +
                        " </HotelSearchCriteria>\n" +
                        " </AvailRequestSegment>\n" +
                        "</AvailRequestSegments>\n" +
                        "</OTA_HotelAvailRQ>";
            }
                param = param+paramEnd;
                String result = callAPIFunc("text/xml;charset=utf-8", "http://ws.adholidays.com/hotelapidev/otaservice.aspx", param,"POST");
                System.out.println(result);
                JSONObject jsonObject = XML.toJSONObject(result);
                JSONObject roomStay = jsonObject.getJSONObject("OTA_HotelAvailRS").getJSONObject("RoomStays").getJSONObject("RoomStay");
                System.out.println(roomStay);

                JSONObject guestCounts = roomStay.getJSONObject("GuestCounts");
                GuestCounts guestCountsObj = JSONUtil.toBean(guestCounts, GuestCounts.class);

                JSONObject roomTypes = roomStay.getJSONObject("RoomTypes");
                RoomTypes roomTypesObj = JSONUtil.toBean(roomTypes, RoomTypes.class);

                JSONObject ratePlans = roomStay.getJSONObject("RatePlans");
                RatePlans ratePlansObj = JSONUtil.toBean(ratePlans, RatePlans.class);

                JSONObject roomRates = roomStay.getJSONObject("RoomRates");
                RoomRates roomRatesObj = JSONUtil.toBean(roomRates, RoomRates.class);

                JSONObject cancelPenalties = roomStay.getJSONObject("CancelPenalties");
                CancelPenalties cancelPenaltiesObj = JSONUtil.toBean(roomRates, CancelPenalties.class);

                JSONObject basicPropertyInfo = roomStay.getJSONObject("BasicPropertyInfo");
                BasicPropertyInfo basicPropertyInfoObj = JSONUtil.toBean(basicPropertyInfo, BasicPropertyInfo.class);
                HotelRoomType hotelRoomType = new HotelRoomType();
                //根据保存酒店的时候，保存的hotelCode，关联上HotelId
                QueryWrapper<Hotel> queryWrapper = new QueryWrapper<>();
                queryWrapper.lambda().eq(Hotel::getId,westminsterRoomTypeReq.getHotelCode());
                queryWrapper.lambda().eq(Hotel::getIsDeleted, IsDeletedCode.NO.getCode());
                Hotel hotel = hotelMapper.selectOne(queryWrapper);
                //保存房型
                if(hotel!=null){
                    //首先判断该酒店的该房型已经是否存在在表里了，存在了就不保存，否则进行保存
                    hotelRoomType.setHotelId(hotel.getId());
                    hotelRoomType.setName(roomTypesObj.getRoomType().getRoomType());
                    hotelRoomType.setId(IdWorker.getId());
                    hotelRoomType.setGmtCreate(LocalDateTime.now());
                    hotelRoomType.setCreateId(user.getId());
                    hotelRoomType.setIsDeleted(IsDeletedCode.NO.getCode());
                    hotelRoomTypeMapper.insert(hotelRoomType);

                    //将房型保存产品
                    HotelProduct hotelProduct = new HotelProduct();
                    hotelProduct.setId(IdWorker.getId());
                    hotelProduct.setHotelId(hotel.getId());
                    hotelProduct.setRoomId(hotelRoomType.getId());
                    if(ratePlansObj.getRatePlan().getMealsIncluded().getBreakfast()==true){//1 不含早 2 单早 3 双早
                        hotelProduct.setHasBreakfast(2);//
                    }else{
                        hotelProduct.setHasBreakfast(1);
                    }
                    hotelProduct.setChargeUser(user.getUsername());
                    hotelProduct.setChargeId(user.getId());
                    hotelProduct.setName(roomTypesObj.getRoomType().getRoomType());
                    hotelProduct.setCreateId(user.getId());
                    hotelProduct.setGmtCreate(LocalDateTime.now());
                    hotelProduct.setProductCode(roomTypesObj.getRoomType().getRoomTypeCode());//暂定
                    hotelProductMapper.insert(hotelProduct);

                    //保存成本
                    //保存之前，先删除该酒店下的该房型所有成本数据以及成本日期数据
                    QueryWrapper<HotelProductCost> queryWrapperHotelProductCost = new QueryWrapper<>();
                    queryWrapperHotelProductCost.lambda().eq(HotelProductCost::getHotelProductId,hotelProduct.getId());
                    //queryWrapperHotelProductCost.lambda().eq(HotelProductCost::getIsDeleted, IsDeletedCode.NO.getCode());
                    List<HotelProductCost> hotelProductCosts = hotelProductCostMapper.selectList(queryWrapperHotelProductCost);
                    if(CollectionUtils.isNotEmpty(hotelProductCosts)){
                        //删除成本
                        for (int j = 0; j <hotelProductCosts.size(); j++) {
                            HotelProductCost hotelProductCost = hotelProductCosts.get(i);
                            hotelProductCostMapper.deleteById(hotelProductCost.getId());
                            //删除成本日期
                            QueryWrapper<HotelProductCostDate> queryWrapperHotelProductCostDate = new QueryWrapper<>();
                            queryWrapperHotelProductCostDate.lambda().eq(HotelProductCostDate::getCostId,hotelProduct.getId());
                            List<HotelProductCostDate> hotelProductCostDates = hotelProductCostDateMapper.selectList(queryWrapperHotelProductCostDate);
                            if(CollectionUtils.isNotEmpty(hotelProductCostDates)){
                                for (int k = 0; k < hotelProductCostDates.size(); k++) {
                                    HotelProductCostDate hotelProductCostDate = hotelProductCostDates.get(i);
                                    hotelProductCostDateMapper.deleteById(hotelProductCostDate.getId());
                                }
                            }
                        }
                    }
                    HotelProductCost hotelProductCost = new HotelProductCost();
                    hotelProductCost.setHotelProductId(hotelProduct.getId());
                    hotelProductCost.setId(IdWorker.getId());
                    //hotelProductCost.setCurrencyId();
                    hotelProductCost.setCurrencyName(roomRatesObj.getRoomRate().getTotal().getCurrencyCode());
                    hotelProductCost.setPrice(roomRatesObj.getRoomRate().getTotal().getAmountBeforeTax());
                    hotelProductCost.setCostName(roomRatesObj.getRoomRate().getTotal().getCurrencyCode()+"的成本信息");
                    hotelProductCost.setStock(999);//西敏是没有库存的，能查到则代表目前仍有库存，999代表无限库存
                    hotelProductCostMapper.insert(hotelProductCost);

                    //保存成本日期
                    HotelProductCostDate hotelProductCostDate = new HotelProductCostDate();
                    hotelProductCostDate.setId(IdWorker.getId());
                    hotelProductCostDate.setCostId(hotelProductCost.getId());
                    hotelProductCostDate.setDateBegin(westminsterRoomTypeReq.getStart());
                    hotelProductCostDate.setDateEnd(westminsterRoomTypeReq.getEnd());
                    hotelProductCostDateMapper.insert(hotelProductCostDate);
                }
            }
        }else{
            return Result.failed(SystemError.HOTEL_10061);
        }
        return Result.success();
    }

    @Override
    @Transactional(readOnly=false,propagation= Propagation.REQUIRED)
    public Result westminsterCreatOrder(TokenUser user) {
        String param = "<?xml version=\"1.0\"?>\n" +
                "<OTA_HotelResRQ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Version=\"0\"\n" +
                "xmlns=\"http://www.opentravel.org/OTA/2003/05\">\n" +
                "<POS>\n" +
                " <Source ISOCountry=\"HK\">\n" +
                " <RequestorID ID=\"xxx@test.com\" MessagePassword=\"12345678\"/>\n" +
                " </Source>\n" +
                "</POS>\n" +
                " <HotelReservations>" +
                "<HotelReservation>\n" +
                " <UniqueID ID=\"PKG001\" ID_Context=\"XXX\">\n" +
                " <RoomStays>\n" +
                " <RoomStay>\n" +
                " <RoomTypes>\n" +
                " <RoomType RoomType=\"Standard 2 Beds(Twin)\" RoomTypeCode=\"2@13379_0\" />\n" +
                " </RoomTypes>\n" +
                " <RatePlans>\n" +
                " <RatePlan RatePlanID=\"0005-F\" />\n" +
                " </RatePlans>\n" +
                " <TimeSpan Start=\"2010-10-22\" End=\"2010-10-25\" />\n" +
                " <BasicPropertyInfo HotelCode=\"12345\" />\n" +
                " <ResGuestRPHs>1 2</ResGuestRPHs>\n" +
                " <Total AmountBeforeTax=\"18660.0\" CurrencyCode=\"HKD\"/>\n" +
                " </RoomStay>\n" +
                " <RoomStay>\n" +
                " <RoomTypes>\n" +
                " <RoomType RoomType=\"Standard 2 Beds(Twin)\" RoomTypeCode=\"2@13379_0\" />\n" +
                " </RoomTypes>\n" +
                " <RatePlans>\n" +
                " <RatePlan RatePlanID=\"0005-F\" />\n" +
                " </RatePlans>\n" +
                " <TimeSpan Start=\"2010-10-22\" End=\"2010-10-25\" />\n" +
                " <Guarantee>\n" +
                " <GuaranteeDescription>\n" +
                " <Text />\n" +
                " </GuaranteeDescription>\n" +
                " </Guarantee>\n" +
                " <BasicPropertyInfo HotelCode=\"12345\" />\n" +
                " <ResGuestRPHs>3 4</ResGuestRPHs>\n" +
                " <Total AmountBeforeTax=\"18660.0\" CurrencyCode=\"HKD\"/>\n" +
                " </RoomStay>\n" +
                " </RoomStays>\n" +
                " <ResGuests>\n" +
                " <ResGuest ResGuestRPH=\"1\" PrimaryIndicator=\"true\">\n" +
                " <Profiles>\n" +
                " <ProfileInfo>\n" +
                " <Profile>\n" +
                " <Customer>\n" +
                " <PersonName>\n" +
                " <NamePrefix>MR</NamePrefix>\n" +
                " <GivenName>KEL01</GivenName>\n" +
                " <Surname>TEST ADH</Surname>\n" +
                " </PersonName>\n" +
                " </Customer>\n" +
                " </Profile>\n" +
                " </ProfileInfo>\n" +
                " </Profiles>\n" +
                " <ArrivalTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0715\" Time=\"2010-10-22T10:29:00\" />\n" +
                " </ArrivalTransport>\n" +
                " <DepartureTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0716\" Time=\"2010-10-25T10:10:00\" />" +
                "</DepartureTransport>\n" +
                " <GuestCounts>\n" +
                " <GuestCount AgeQualifyingCode=\"10\" />\n" +
                " </GuestCounts>\n" +
                " </ResGuest>\n" +
                " <ResGuest ResGuestRPH=\"2\">\n" +
                " <Profiles>\n" +
                " <ProfileInfo>\n" +
                " <Profile>\n" +
                " <Customer>\n" +
                " <PersonName>\n" +
                " <NamePrefix>MR</NamePrefix>\n" +
                " <GivenName>CHILD</GivenName>\n" +
                " <Surname>TEST ADH</Surname>\n" +
                " </PersonName>\n" +
                " </Customer>\n" +
                " </Profile>\n" +
                " </ProfileInfo>\n" +
                " </Profiles>\n" +
                " <ArrivalTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0715\" Time=\"2010-10-22T10:29:00\" />\n" +
                " </ArrivalTransport>\n" +
                " <DepartureTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0716\" Time=\"2010-10-25T10:10:00\" />\n" +
                " </DepartureTransport>\n" +
                " <GuestCounts>\n" +
                " <GuestCount AgeQualifyingCode=\"8\" Age=\"5\" />\n" +
                " </GuestCounts>\n" +
                " </ResGuest>\n" +
                " <ResGuest ResGuestRPH=\"3\">\n" +
                " <Profiles>\n" +
                " <ProfileInfo>\n" +
                " <Profile>\n" +
                " <Customer>\n" +
                " <PersonName>\n" +
                " <NamePrefix>MR</NamePrefix>\n" +
                " <GivenName>KEL 03</GivenName>\n" +
                " <Surname>TEST ADH</Surname>\n" +
                " </PersonName>\n" +
                " </Customer>\n" +
                " </Profile>\n" +
                " </ProfileInfo>\n" +
                " </Profiles>\n" +
                " <ResGuest ResGuestRPH=\"4\">\n" +
                " <Profiles>\n" +
                " <ProfileInfo>\n" +
                " <Profile>\n" +
                " <Customer>\n" +
                " <PersonName>\n" +
                " <NamePrefix>MR</NamePrefix>\n" +
                " <GivenName>KEL 04</GivenName>\n" +
                " <Surname>TEST ADH</Surname>" +
                "</PersonName>\n" +
                " </Customer>\n" +
                " </Profile>\n" +
                " </ProfileInfo>\n" +
                " </Profiles>\n" +
                " <ArrivalTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0715\" Time=\"2010-10-22T10:29:00\" />\n" +
                " </ArrivalTransport>\n" +
                " <DepartureTransport>\n" +
                " <TransportInfo Type=\"Flight\" ID=\"0716\" Time=\"2010-10-25T10:10:00\" />\n" +
                " </DepartureTransport>\n" +
                " <GuestCounts>\n" +
                " <GuestCount AgeQualifyingCode=\"10\" />\n" +
                " </GuestCounts>\n" +
                " </ResGuest>\n" +
                " </ResGuests>\n" +
                " <ResGlobalInfo>\n" +
                " <SpecialRequests>\n" +
                " <SpecialRequest>\n" +
                " <Text>abc</Text>\n" +
                " </SpecialRequest>\n" +
                " </SpecialRequests>\n" +
                " <Comments>\n" +
                " <Comment>\n" +
                " <Text>RqNonSmokingFloor</Text>\n" +
                " <Text>RqDblBed</Text>\n" +
                " <Text>RQEarlyCheckin</Text>\n" +
                " </Comment>\n" +
                " </Comments>\n" +
                " </ResGlobalInfo>\n" +
                " <TPA_Extensions>\n" +
                " <Agent>\n" +
                " <ContactPerson>OPH</ContactPerson>\n" +
                " <EmailOrFax>pakho.or@hkwtl.com</EmailOrFax>\n" +
                " <Phone>23139735</Phone>\n" +
                " </Agent>\n" +
                " </TPA_Extensions>\n" +
                " </HotelReservation>\n" +
                " </HotelReservations>\n" +
                "</OTA_HotelResRQ>";

        return Result.success();
    }

    public static String createParameter(String params){
        params = null;

        return params;
    }

}